package com.example.demo.kafka.service;

import com.example.demo.kafka.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

/**
 * Created by ssd on 2018/6/15.
 */
@Component
public class KafkaProviderService {
    @Autowired
    private KafkaTemplate kafkaTemplate;
    public void send(String topic, User user){
        kafkaTemplate.send(topic,user.toString());
    }
}
